#ifndef LOGGER_H
#define LOGGER_H
#include <fstream>
#include <iostream>
#include <string>
using   std::ostream;
using  std::string;

#define DEBUG 4     //just in console

//lever <= INFO will log message at file
//lever<=m_level sill show message in console
#define INFO 3
#define WARN 2
#define ERROR 1
/*
usage:
logger p("*");
p.log((int level,string positon,string message);

logger::m_level 修改输出到控制台的等级。
*/
class logger
{
    public:
        logger(string);
        virtual ~logger();
        unsigned int Getm_Counter() { return m_Counter; }

        string Getm_name() { return m_name; }
        void Setm_name(string val) { m_name = val; }

        void log(int level,string positon,string message);
        void log_few(int level,string message);

        logger& operator<<(string mes);
        logger& operator<<(int mes);
        logger& operator<<(float mes);
        logger& operator<<(long mes);
        static int m_level;
        string m_path;
    protected:
    private:
        std::ofstream m_file;
        unsigned int m_Counter;
        string m_name;
};
//static logger console_out("console.log");
#endif // LOGGER_H
